home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d18
/
qwik30.arc
/
QSTORES.INC
< prev
next >
Wrap
Text File
|
1991-01-09
|
10KB
|
144 lines
{ Qstores.inc - transfers blocks between screen and memory. ver 3.0, 08-31-87 }
{ These procedures do fast screen transfers of a Rows-by-Cols block to memory
and vice-versa. It also automatically configures to your machine since
Qinit is required. The upper left column is 1,1. Cols can range from
1 to screen limits. }
{ QstoreToMem - saves screen display for later use ver 2.0, 11-24-86 }
procedure QstoreToMem (Row, Col, Rows, Cols: byte; VAR Dest);
begin
Inline( {Assembly by Inline 08/17/87 17:53}
$8B/$5E/<ROWS/ { mov bx,[bp+<Rows] ;Move number of rows}
$8B/$4E/<COLS/ { mov cx,[bp+<Cols] ;Move number of cols}
{ ;}
$85/$DB/ { test bx,bx ;If Rows<=0 ...}
$7E/$63/ { jle Exit ; nothing to do}
$85/$C9/ { test cx,cx ;If Cols<=0 ...}
$7E/$5F/ { jle Exit ; nothing to do}
{ ;}
$31/$D2/ { xor dx,dx ;Set DX=0}
$8E/$C2/ { mov es,dx ;Set ES=0}
$26/ { es: ;Segment override}
$8A/$16/$4A/$04/ { mov dl,[$044A] ;Get CRT columns}
$8B/$46/<ROW/ { mov ax,[bp+<Row] ;Move row in AX}
$48/ { dec ax ;Convert to 0-?? range}
$F6/$E2/ { mul dl ;(CRT columns)*(Row-1)}
$89/$C6/ { mov si,ax ;Partial offset in SI}
$03/$76/<COL/ { add si,[bp+<Col] ;Add Col}
$4E/ { dec si ;Convert to 0-?? range}
$D1/$E6/ { shl si,1 ;Source offset calc'd}
$29/$CA/ { sub dx,cx ;DX=(CRT columns)-Cols}
$D1/$E2/ { shl dx,1 ;Mult by 2}
$52/ { push dx ;Save # to next row}
$51/ { push cx ;Save Cols}
$1E/ { push ds ;Save Turbo's DS}
$FC/ { cld ;Set DF to increment}
$C4/$7E/<DEST/ { les di,[bp+<Dest] ;ES:DI points to Dest}
$3A/$2E/>QWAIT/ { cmp ch,[>Qwait] ;Check need for wait}
$8E/$1E/>QSEG/ { mov ds,[>Qseg] ;DS:SI source pointer}
$75/$0C/ { jne Color ; use Color routine}
{ ;}
{; -- Mono routine; Attr, Char and No Wait--}
$F2/$A5/ {Mono: rep movsw ;To dest & inc DI 2}
$4B/ { dec bx ;Decrement rows left}
$74/$29/ { jz Done ;If Rows=0, done}
$8B/$4E/$FA/ { mov cx,[bp-$06] ;Restore Cols}
$01/$D6/ { add si,dx ;Source for next row}
$EB/$F4/ { jmp SHORT Mono ;Next row}
{ ;}
{; -- Color routine; Attr, Char and Wait --}
$BA/$DA/$03/ {Color: mov dx,$03DA ;CGA port}
$FA/ {Col1A: cli ;Disable interrupts}
$EC/ {E4in: in al,dx ;Check CGA status}
$A8/$08/ { test al,$08 ;If #3 bit set ...}
$75/$09/ { jnz ColrB ; skip wait}
$D0/$D8/ { rcr al,1 ;If #0 bit set ...}
$72/$F7/ { jc E4in ; try again for $E4}
$EC/ {E5in: in al,dx ;Check CGA status}
$D0/$D8/ { rcr al,1 ;If #0 bit clear ...}
$73/$FB/ { jnc E5in ; try again for $E5}
$AD/ {ColrB: lodsw ;Load char & attr}
$FB/ { sti ;Enable interrupts}
$AB/ { stosw ;Put in dest & inc DI}
$E2/$EC/ { loop Col1A ;Loop till CX=0}
$4B/ { dec bx ;Decrement rows left}
$74/$08/ { jz Done ;If Rows=0, done}
$8B/$4E/$FA/ { mov cx,[bp-$06] ;Restore Cols}
$03/$76/$FC/ { add si,[bp-$04] ;Source for next row}
$EB/$E1/ { jmp SHORT Col1A ;Next row}
{ ;}
$1F/ {Done: pop ds ;Restore Turbo's DS}
$81/$C4/$04/$00 { add sp,$0004 ;Restore stack ptr}
); {Exit:}
end;
{ QstoreToScr - restores screen display ver 2.1, 12-09-86 }
procedure QstoreToScr (Row, Col, Rows, Cols: byte; VAR Source);
begin
Inline( {Assembly by Inline 08/17/87 17:53}
$8B/$5E/<ROWS/ { mov bx,[bp+<Rows] ;Move number of rows}
$8B/$4E/<COLS/ { mov cx,[bp+<Cols] ;Move number of cols}
{ ;}
$85/$DB/ { test bx,bx ;If Rows<=0 ...}
$7E/$68/ { jle Exit ; nothing to do}
$85/$C9/ { test cx,cx ;If Cols<=0 ...}
$7E/$64/ { jle Exit ; nothing to do}
{ ;}
$31/$D2/ { xor dx,dx ;Set DX=0}
$8E/$C2/ { mov es,dx ;Set ES=0}
$26/ { es: ;Segment override}
$8A/$16/$4A/$04/ { mov dl,[$044A] ;Get CRT columns}
$8B/$46/<ROW/ { mov ax,[bp+<Row] ;Move row in AX}
$48/ { dec ax ;Convert to 0-?? range}
$F6/$E2/ { mul dl ;(CRT columns)*(Row-1)}
$89/$C7/ { mov di,ax ;Partial offset in DI}
$03/$7E/<COL/ { add di,[bp+<Col] ;Add Col}
$4F/ { dec di ;Convert to 0-?? range}
$D1/$E7/ { shl di,1 ;Source offset calc'd}
$29/$CA/ { sub dx,cx ;DX=(CRT columns)-Cols}
$D1/$E2/ { shl dx,1 ;Mult by 2}
$52/ { push dx ;Save # to next row}
$51/ { push cx ;Save Cols}
$1E/ { push ds ;Save Turbo's DS}
$FC/ { cld ;Set DF to increment}
$3A/$2E/>QWAIT/ { cmp ch,[>Qwait] ;Check need for wait}
$8E/$06/>QSEG/ { mov es,[>Qseg] ;ES:DI screen pointer}
$C5/$76/<SOURCE/ { lds si,[bp+<Source] ;DS:SI source pointer}
$75/$0C/ { jne Color ; use Color routine}
{ ;}
{; -- Mono routine; Attr, Char and No Wait--}
$F2/$A5/ {Mono: rep movsw ;To dest & inc DI 2}
$4B/ { dec bx ;Decrement rows left}
$74/$2E/ { jz Done ;If Rows=0, done}
$8B/$4E/$FA/ { mov cx,[bp-$06] ;Restore Cols}
$01/$D7/ { add di,dx ;Dest for next row}
$EB/$F4/ { jmp SHORT Mono ;Next row}
{ ;}
{; -- Color routine; Attr, Char and Wait --}
$BA/$DA/$03/ {Color: mov dx,$03DA ;CGA port}
$AD/ {Col1A: lodsw ;Load char & attr}
$88/$C7/ { mov bh,al ;Save char in BH}
$FA/ { cli ;Disable interrupts}
$EC/ {E4in: in al,dx ;Check CGA status}
$A8/$08/ { test al,$08 ;If #3 bit set ...}
$75/$09/ { jnz ColrB ; skip wait}
$D0/$D8/ { rcr al,1 ;If #0 bit set ...}
$72/$F7/ { jc E4in ; try again for $E4}
$EC/ {E5in: in al,dx ;Check CGA status}
$D0/$D8/ { rcr al,1 ;If #0 bit clear ...}
$73/$FB/ { jnc E5in ; try again for $E5}
$88/$F8/ {ColrB: mov al,bh ;Move char back in AL}
$AB/ { stosw ;Put in dest & inc DI}
$FB/ { sti ;Enable interrupts}
$E2/$E8/ { loop Col1A ;Loop till CX=0}
$FE/$CB/ { dec bl ;Decrement rows left}
$74/$08/ { jz Done ;If Rows=0, done}
$8B/$4E/$FA/ { mov cx,[bp-$06] ;Restore Cols}
$03/$7E/$FC/ { add di,[bp-$04] ;Dest for next row}
$EB/$DC/ { jmp SHORT Col1A ;Next row}
{ ;}
$1F/ {Done: pop ds ;Restore Turbo's DS}
$81/$C4/$04/$00 { add sp,$0004 ;Restore stack ptr}
); {Exit:}
end;